package com.ddh.ddhsanguogame.controller;


import com.ddh.ddhsanguogame.common.BaseResponse;
import com.ddh.ddhsanguogame.common.DongResultUtils;
import com.ddh.ddhsanguogame.dto.CardMessageDTO;
import com.ddh.ddhsanguogame.entity.CardMessage;
import com.ddh.ddhsanguogame.service.ICardMessageService;
import com.ddh.ddhsanguogame.vo.CardMessageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 消息表 前端控制器
 * </p>
 *
 * @author
 * @since 2025-06-29
 */
@RestController
@RequestMapping("/cardMessage")
@Api(tags = "消息表")
public class CardMessageController {

    @Resource
    private ICardMessageService cardMessageService;

    /**
     * 根据消息类型获取消息
     */
    @PostMapping("/getHistoryMessage")
    @ApiOperation("根据消息类型获取消息")
    public BaseResponse<List<CardMessageVO>> getHistoryMessage(@RequestBody CardMessageDTO cardMessageDTO) {
        List<CardMessageVO> cardMessageVOList = cardMessageService.getHistoryMessage(cardMessageDTO);
        return DongResultUtils.success(cardMessageVOList);
    }

}
